
exports.cookieKeys = ['arche is so good', 'I like it so much'];

exports.log4js = {
  appenders: {
    access: {
      type: 'dateFile',
      pattern: '-yyyyMMdd.log', //生成文件的规则
      filename: 'logs/access.log',
      layout: {
        type: 'pattern',
        pattern: '[%d{yyyy-MM-dd hh:mm:ss.SSS}] %m',
      },
    },
    context: {
      type: 'dateFile',
      pattern: '-yyyyMMdd.log',
      filename: 'logs/context.log',
      layout: {
        type: 'pattern',
        pattern: '[%d{yyyy-MM-dd hh:mm:ss.SSS}] [%p] %c - %m',
      },
    },
    console: {
      type: 'console',
      layout: {
        type: 'pattern',
        pattern: '[%d{yyyy-MM-dd hh:mm:ss.SSS}] [%p] %c - %m',
      },
    }
  },
  categories: {
    default: { appenders: ['console', 'context'], level: 'DEBUG' },
    context: { appenders: ['console', 'context'], level: 'DEBUG' },
    access: { appenders: ['access'], level: 'INFO' },
  }
};

exports.bodyparser = {
  multipart: true,
  formLimit: '1mb',
  jsonLimit: '1mb',
};

// exports.redis = {
//   host: 'localhost',
//   port: '6379',
//   password: 'password',
// };

// exports.database = {
//   default: {
//     connectString: 'localhost',
//     user: 'user',
//     password: 'password',
//   },
// };

// exports.rabbitmq = {
//   url: "amqp://user:pwd@localhost",
// };

exports.ratelimit = {
  driver: 'memory',
  db: new Map(),
  duration: 60 * 1000,
  errorMessage: 'Sometimes You Just Have to Slow Down.',
  id: (ctx) => ctx.ip,
  headers: {
    remaining: 'Rate-Limit-Remaining',
    reset: 'Rate-Limit-Reset',
    total: 'Rate-Limit-Total'
  },
  max: 100,
  disableHeader: false,
  whitelist: (ctx) => {
    // some logic that returns a boolean
  },
  blacklist: (ctx) => {
    // some logic that returns a boolean
  }
};
